﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:igEditors="http://schemas.infragistics.com/xaml"
    xmlns:igEditorsPrim="http://schemas.infragistics.com/xaml/primitives"
	  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	  mc:Ignorable="d">

    <!-- *********************************  COLORS  ********************************* -->
    <ResourceDictionary.MergedDictionaries>
      <ResourceDictionary Source="Theme.Colors.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!-- *********************************  BRUSHES  ********************************* -->
  <SolidColorBrush x:Key="ForegroundBrush" Color="{StaticResource Color_001}"/>
  <SolidColorBrush x:Key="TransparentBrush" Color="{StaticResource Color_016}"/>
  <SolidColorBrush x:Key="DisabledBackgroundBrush" Color="{StaticResource Color_012}"/>

  <!-- Button Brushes -->
  <SolidColorBrush x:Key="ButtonArrowBackgroundBrush" Color="{StaticResource Color_003}"/>
  <SolidColorBrush x:Key="ButtonArrowHoverBackgroundBrush" Color="{StaticResource Color_002}"/>
  <SolidColorBrush x:Key="ButtonArrowPressedBackgroundBrush" Color="{StaticResource Color_024}"/>
  <SolidColorBrush x:Key="ButtonArrowDisabledBackgroundBrush" Color="{StaticResource Color_005}"/>

    <!-- MaskedInput Brushes -->
  <SolidColorBrush x:Key="InputBackgroundBrush" Color="{StaticResource Color_009}"/>
  <SolidColorBrush x:Key="InputBorderBrush" Color="{StaticResource Color_004}"/>
  <SolidColorBrush x:Key="InputHoverBackgroundBrush" Color="{StaticResource Color_007}"/>
  <SolidColorBrush x:Key="InputHoverBorderBrush" Color="{StaticResource Color_003}"/>
  <SolidColorBrush x:Key="InputFocusedBorderBrush" Color="{StaticResource Color_024}"/>

    <!-- *********************************  Value Converters  ********************************* -->
    <igEditorsPrim:HorizontalToTextAlignmentConverter x:Key="horizToTextAlignmentConverter"/>

    <!-- *********************************  RepeatButtonTemplate  ********************************* -->
    <ControlTemplate x:Key="RepeatButtonTemplate" TargetType="RepeatButton">
        <Grid>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="Arrow">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonArrowHoverBackgroundBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="Arrow">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonArrowPressedBackgroundBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Fill" Storyboard.TargetName="Arrow">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonArrowDisabledBackgroundBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                    <VisualState x:Name="Focused"/>
                    <VisualState x:Name="Unfocused"/>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Rectangle Fill="{StaticResource TransparentBrush}" Margin="-5"/>
      <Path x:Name="Arrow" Data="M4.9585595,6.4799328 L9.9993324,1.9604321 L15.061378,6.4794879 L13.686531,7.979373 L9.9993334,4.5627856 L6.3744011,7.9793801 z" Height="6" Stretch="Uniform" Width="10" Fill="{StaticResource ButtonArrowBackgroundBrush}" Margin="{TemplateBinding Padding}"/>
        </Grid>
    </ControlTemplate>

    <!-- *********************************  SpinButton Style  ********************************* -->
    <Style x:Key="SpinButtonStyle" TargetType="RepeatButton">
        <Setter Property="MinHeight" Value="30"/>
        <Setter Property="MinWidth" Value="30"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="3,1"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="igEditorsPrim:XamlHelper.Focusable" Value="False"/>
        <Setter Property="Template" Value="{StaticResource RepeatButtonTemplate}"/>
    </Style>

    <!-- *********************************  MaskedInputTextBox Style  ********************************* -->
    <Style x:Key="MaskedInputTextBoxStyle" TargetType="TextBox">
        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
    </Style>

    <!-- *********************************  MaskedInput Style  ********************************* -->
    <Style x:Key="MaskedInputStyle" TargetType="igEditors:XamMaskedInput">
    <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}"/>
    <Setter Property="BorderBrush" Value="{StaticResource InputBorderBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
        <Setter Property="FontSize" Value="14.667"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="Padding" Value="8,0"/>
        <Setter Property="igEditorsPrim:XamlHelper.SnapsToDevicePixels" Value="True"/>
      <Setter Property="SpinButtonStyle" Value="{StaticResource SpinButtonStyle}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
      <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="MinHeight" Value="30"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="igEditors:XamMaskedInput">
                    <igEditorsPrim:ValidationDecorator x:Name="MainBorder">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Background" Storyboard.TargetName="Background">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource InputHoverBackgroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="OverBorder">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="DisabledElement">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="ReadOnly"/>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Unfocused"/>
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="FocusBorder">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                                <Border x:Name="Background" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}">
                                <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                    <igEditorsPrim:MaskedInputTextBox x:Name="PART_InputTextBox" Style="{StaticResource MaskedInputTextBoxStyle}" HorizontalAlignment="Stretch" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="Stretch" TextAlignment="{Binding HorizontalContentAlignment, Converter={StaticResource horizToTextAlignmentConverter}, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" InputMethod.PreferredImeState="{TemplateBinding InputMethod.PreferredImeState}" Margin="{TemplateBinding Padding}" igEditorsPrim:XamlHelper.Focusable="{TemplateBinding igEditorsPrim:XamlHelper.Focusable}" IsTabStop="{TemplateBinding IsTabStop}"/>
                                <Grid x:Name="PART_SpinButtons" Grid.Column="1" Visibility="{TemplateBinding SpinButtonVisibilityResolved}">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="1"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <RepeatButton x:Name="spinUp" Style="{TemplateBinding SpinButtonStyle}" >
                                        <igEditors:Commanding.Command>
                                            <igEditorsPrim:MaskedInputCommandSource EventName="Click" CommandId="SpinUp"/>
                                        </igEditors:Commanding.Command>
                                    </RepeatButton>
                                    <RepeatButton x:Name="spinDown" Style="{TemplateBinding SpinButtonStyle}" Grid.Column="2" RenderTransformOrigin="0.5,0.5">
                                        <RepeatButton.RenderTransform>
                                            <TransformGroup>
                                                <ScaleTransform/>
                                                <SkewTransform/>
                                                <RotateTransform Angle="180"/>
                                                <TranslateTransform/>
                                            </TransformGroup>
                                        </RepeatButton.RenderTransform>
                                        <igEditors:Commanding.Command>
                                            <igEditorsPrim:MaskedInputCommandSource EventName="Click" CommandId="SpinDown"/>
                                        </igEditors:Commanding.Command>
                                    </RepeatButton>
                                </Grid>
                            </Grid>
                            </Border>
              <Border x:Name="OverBorder" BorderThickness="1" Opacity="0" BorderBrush="{StaticResource InputHoverBorderBrush}" />
              <Border x:Name="FocusBorder" BorderThickness="1" Opacity="0" BorderBrush="{StaticResource InputFocusedBorderBrush}" />
              <Rectangle x:Name="DisabledElement" Fill="{StaticResource DisabledBackgroundBrush}" Visibility="Collapsed"/>
                        </Grid>
                    </igEditorsPrim:ValidationDecorator>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="igEditors:XamMaskedInput" BasedOn="{StaticResource MaskedInputStyle}">
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
    </Style>

    <!-- *********************************  XamNumericInput Style  ********************************* -->
    <Style TargetType="igEditors:XamNumericInput" BasedOn="{StaticResource MaskedInputStyle}">
        <Setter Property="HorizontalContentAlignment" Value="Right"/>
    </Style>

    <!-- *********************************  XamCurrencyInput Style  ********************************* -->
    <Style TargetType="igEditors:XamCurrencyInput" BasedOn="{StaticResource MaskedInputStyle}">
        <Setter Property="HorizontalContentAlignment" Value="Right"/>
    </Style>
</ResourceDictionary>